Skip to content

Add custom OAuth consent security guide#3413

Merged
jescalan merged 7 commits into
rob/oauth-consent-docsfrom
je/docs-oauth-custom-consent-page-stack
Jun 17, 2026
Merged

Add custom OAuth consent security guide#3413
jescalan merged 7 commits into
rob/oauth-consent-docsfrom
je/docs-oauth-custom-consent-page-stack

Conversation

@jescalan

@jescalan jescalan commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Stacks on #3315. Adds a security-focused guide for configuring a custom OAuth consent page, with a strong recommendation to use the Account Portal or the prebuilt <OAuthConsent /> component instead of a fully custom flow.

The guide covers consent phishing risk, required consent-screen content, redirect URI presentation, route configuration, safer appearance-based customization, and low-level custom-flow responsibilities.

Changes in this repo

  • Adds Customize the OAuth consent page to the OAuth guide section.
  • Adds tabbed prebuilt <OAuthConsent /> examples for Next.js, React, React Router, TanStack React Start, Astro, Vue, and Nuxt.
  • Adds low-level custom-flow examples for React-based SDKs, with warnings about redirect URI presentation and organization selection.
  • Cross-links the new guide from existing OAuth docs.
  • Updates the OAuth consent component and hook references from Add OAuthConsent and useOAuthConsent docs #3315 to point to the guide and fixes a few snippet accuracy issues.

Preview links

New pages:

Changed sections:

Parent PR

Validation

  • rtk pnpm -C clerk-docs build
  • rtk pnpm -C clerk-docs lint
  • rtk git -C clerk-docs diff --check

@vercel

vercel Bot commented Jun 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
clerk-docs Ready Ready Preview Jun 16, 2026 4:14pm

Request Review

@jescalan jescalan marked this pull request as ready for review June 1, 2026 23:39
@jescalan jescalan requested a review from a team as a code owner June 1, 2026 23:39

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6ae5e884d1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/_partials/components/oauth-consent-examples.mdx Outdated
Comment thread docs/_partials/components/oauth-consent-custom-flow-examples.mdx Outdated
Comment thread docs/_partials/components/oauth-consent-custom-flow-examples.mdx Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7beb713efd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/_partials/components/oauth-consent-custom-flow-examples.mdx Outdated
@jescalan jescalan requested review from jfoshee and wobsoriano June 2, 2026 15:44

@wobsoriano wobsoriano left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks good on my end 👍🏼

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0bf3843f32

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/reference/components/authentication/oauth-consent.mdx Outdated
@jescalan

jescalan commented Jun 2, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@jescalan

jescalan commented Jun 2, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/_partials/components/oauth-consent-custom-flow-examples.mdx Outdated
Comment thread docs/_partials/components/oauth-consent-examples.mdx
Comment thread docs/guides/configure/auth-strategies/oauth/custom-consent-page.mdx

These examples display the full redirect hostname and an expandable full URL. For a production custom flow, use a public-suffix-aware approach for root-domain summaries, handle IP addresses and localhost explicitly, and test long redirect URIs to make sure the real destination remains visible.

These examples also do not implement organization selection. If an OAuth application can request `user:org:read`, use `<OAuthConsent />` or add an organization selector that submits the selected `organization_id` with the allow action.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How can we remember to update this bit when <OrgSelect /> is made generally available? 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 18e9ae2 by making the limitation explicit and searchable: the guide now says to use <OAuthConsent /> or a custom organization selector until Clerk exposes a public organization selector for OAuth consent flows. That should give us a clear breadcrumb to update this section when a public selector is available.

~ 🤖

Comment thread docs/guides/configure/auth-strategies/oauth/custom-consent-page.mdx
Comment thread docs/guides/configure/auth-strategies/oauth/custom-consent-page.mdx
@jfoshee

jfoshee commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

I was just testing these docs with an agent and it failed to hide the navbar. We definitely need some language to remind implementors that the consent dialog should be the only thing on the page-- no other nav like sign-in/out or user button. Any other navigation will break the OAuth flow. @jescalan

@jescalan

jescalan commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

I was just testing these docs with an agent and it failed to hide the navbar. We definitely need some language to remind implementors that the consent dialog should be the only thing on the page-- no other nav like sign-in/out or user button. Any other navigation will break the OAuth flow. @jescalan

Good call. Revised the skill a little bit - should fix this

Comment thread docs/reference/components/authentication/oauth-consent.mdx
Comment thread docs/reference/components/authentication/oauth-consent.mdx Outdated
Comment thread docs/_partials/components/oauth-consent-examples.mdx Outdated
Comment thread docs/_partials/components/oauth-consent-examples.mdx
Comment thread docs/guides/configure/auth-strategies/oauth/custom-consent-page.mdx Outdated
@SarahSoutoul

Copy link
Copy Markdown
Contributor

@jescalan @jfoshee have left a bunch of comments and questions (sorry!) and pushed a minor docs review doing the following:

  • Adding a collapsible: true prop on the code examples within docs/_partials/components/oauth-consent-custom-flow-examples.mdx given their length.
  • Changed the wording of some of the instructions in the Custom consent page to align with the Dashboard UI.

I still need to test some of this so will do that while waiting for responses.

@jescalan

Copy link
Copy Markdown
Contributor Author

@SarahSoutoul ty! addressed the feedback here - if you want to take another look feel free, if you feel like it's all set that's great!

@@ -0,0 +1,154 @@
---
title: Set up a custom OAuth consent page

@SarahSoutoul SarahSoutoul Jun 15, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jescalan @jfoshee Question - is this only possible in the following SDKs:

astro, nextjs, nuxt, react, react-router, tanstack-react-start, vue

Asking cause if so, we should scope this guide to these SDKs, and then use components rather than for the code examples. I can make those changes, but wanna double check first.

Also, what about the custom flow? Right now, there are code examples for Next.js, React, React Router and Tanstack only? But not for Astro, Nuxt and Vue - that's on purpose?

Also, what about JavaScript - component is supported in js-frontend SDK, so would this guide apply to it or not?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nvm about the second question. Just saw this.

Screenshot 2026-06-15 at 2 48 34 pm

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 7546f9e by scoping the custom consent guide to the SDKs that support the prebuilt <OAuthConsent /> component, converting the guide examples from tabs to SDK-filtered <If> blocks, and adding the js-frontend mount example. The low-level custom-flow examples remain limited to the React-based SDKs where useOAuthConsent() is exposed, with the existing note directing Astro, Vue, Nuxt, and JavaScript users toward the prebuilt component unless they intentionally build against ClerkJS.

~ 🤖

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7546f9e857

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/_partials/components/oauth-consent-examples.mdx Outdated
Comment thread docs/_partials/components/oauth-consent-examples.mdx Outdated
Comment thread docs/_partials/components/oauth-consent-examples.mdx Outdated
Comment thread docs/_partials/components/oauth-consent-custom-flow-examples.mdx
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@SarahSoutoul

Copy link
Copy Markdown
Contributor

@jescalan have just pushed a docs review pt2 with quite a few wording / structure changes. Could you take a look, and then I'd be happy to merge this into Rob's branch?

@jescalan jescalan left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SarahSoutoul thanks for the rewrite here, only a couple little comments

Comment thread docs/guides/configure/auth-strategies/oauth/custom-consent-page.mdx Outdated
Comment thread docs/guides/configure/auth-strategies/oauth/custom-consent-page.mdx Outdated
@SarahSoutoul

Copy link
Copy Markdown
Contributor

@SarahSoutoul thanks for the rewrite here, only a couple little comments

Okay have applied changes from the feedback here + approved the PR. This is good to go if you're happy with the changes I made @jescalan.

As a heads up to you and @wobsoriano, once this is merged, I will review the mother PR once again all together to be sure everything looks good.

@jescalan jescalan merged commit 73a9d6e into rob/oauth-consent-docs Jun 17, 2026
3 checks passed
@jescalan jescalan deleted the je/docs-oauth-custom-consent-page-stack branch June 17, 2026 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants